package com.cf.user.login;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * awm-boot-LocalRequestContext
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/6/15 上午 11:03
 */
public class LocalRequestHolder {

    private static ThreadLocal<RequestResponse> requestResponseLocal = new ThreadLocal<>();

    public static void set(HttpServletRequest request, HttpServletResponse response) {
        RequestResponse requestResponse = new RequestResponse(request, response);
        requestResponseLocal.set(requestResponse);
    }

    public static RequestResponse requestResponse() {
        return requestResponseLocal.get();
    }

    public static void clean() {
        requestResponseLocal.remove();
    }

}
